package com.m2bshop.shop.controller;

import com.m2bshop.shop.pojo.BankCard;
import com.m2bshop.shop.service.BankCardService.BankCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RequestMapping("/bankcard")
@RestController
public class BankCardController {
    @Autowired
    BankCardService bankCardService;

    @RequestMapping("/getInfo/{userid}")
    public List<BankCard> getInfo(@PathVariable int userid){
        return bankCardService.getBankAllCard(userid);
    }
    @RequestMapping("/InsertNew")
    public String InsertNewOne(@RequestBody BankCard bankCard){
        return bankCardService.insertNewBankCard(bankCard);
    }
    @RequestMapping("/Delete/{bankid}")
    public String DeleteOne(@PathVariable int bankid){
        return bankCardService.deleteBankCard(bankid);
    }


}
